<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <style>
      * {
        margin: 0;
        padding: 0;
      }
      #outer {
        margin: 50px auto;
        padding: 10px;
        width: 500px;
        text-align: center;
        background-color: gold;
      }
      img {
        width: 500px;
      }
    </style>
    <script>
      window.onload = function () {
        /**
         * 点击按钮切换图片
         */

        var prev = document.getElementById("prev");
        var next = document.getElementById("next");

        var img = document.getElementsByTagName("img")[0];

        perv.onclick = function () {
          img.src = "day 13/img/2.png";
        };
        next.onclick = function () {
          // 切换图片就是修改img的src属性
          img.src = "./img/2.png";
        };
      };
    </script>
  </head>
  <body>
    <div id="outer">
      <img src="./img/屏幕截图 2024-05-16 200537.png" alt="" />
      <button id="prev">上一张</button>
      <button id="next">下一张</button>
    </div>
  </body>
</html>
